package com.TestDemo.cloneTest;

public class Student implements Cloneable{
    private String name;
    private int age;
    // 重写克隆方法
    @Override
    public Object clone(){
        Student student = null;
        try{
            student = (Student) super.clone();
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
        return student;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
